package com.nbsaas.boot.project.rest.convert;

import com.nbsaas.boot.project.data.entity.BusinessModel;
import com.nbsaas.boot.project.api.domain.request.BusinessModelRequest;

import org.springframework.beans.BeanUtils;
import com.nbsaas.boot.rest.api.Converter;
import com.nbsaas.boot.utils.BeanDataUtils;
            import com.nbsaas.boot.project.data.entity.Project;

/**
* 请求对象转换成实体对象
*/

public class BusinessModelEntityConvert  implements Converter<BusinessModel, BusinessModelRequest> {

    @Override
    public BusinessModel convert(BusinessModelRequest source) {
        BusinessModel result = new BusinessModel();
        BeanDataUtils.copyProperties(source, result);
                    if(source.getProject()!=null){
                    Project project =new Project();
                    project.setId(source.getProject());
                    result.setProject(project);
                    }
        return result;
    }
}

